#ifndef XBULLET_H
#define XBULLET_H
#include "GameObjects.h"
#include "GameCore\Sprite.h"
struct BulletInitialValue
{
	char* name;
	char* spriteName;
	int hp;
	int damage;
	int animID;
	Sprite* spriteCache;

	BulletInitialValue()
	{
		name = NULL;
		spriteName = NULL;
		hp = 0;
		damage = 0;
		animID = 0;
		spriteCache = NULL;
	}
	BulletInitialValue(const char* iName, const char* iSprite, const int iHp, const int iDamage, const int iAnimID)
	{
		name = new char[strlen(iName)+1];
		strcpy(name, iName);
		spriteName = new char[strlen(iSprite)+1];
		strcpy(spriteName, iSprite);
		hp = iHp;
		damage = iDamage;
		animID = iAnimID;
		spriteCache = NULL;
	}
	BulletInitialValue(const BulletInitialValue& src)
	{
		name = new char[strlen(src.name)+1];
		strcpy(name, src.name);
		spriteName = new char[strlen(src.spriteName)+1];
		strcpy(spriteName, src.spriteName);
		hp = src.hp;
		damage = src.damage;
		animID = src.animID;
		spriteCache = src.spriteCache;
	}
	const BulletInitialValue& operator=( const BulletInitialValue& src )
	{
		name = new char[strlen(src.name)+1];
		strcpy(name, src.name);
		spriteName = new char[strlen(src.spriteName)+1];
		strcpy(spriteName, src.spriteName);
		hp = src.hp;
		damage = src.damage;
		animID = src.animID;
		spriteCache = src.spriteCache;
		return *this;
	}
	~BulletInitialValue()
	{
		SafeDeleteArray(name);
		SafeDeleteArray(spriteName);
	}
};
class Bullet: public GameObject
{
public:
	enum Target
	{
		PlayerShip = 0x1,
		EnemyShip = 0x2,
		Obstacle = 0x4,
		EnemyBullet = 0x8,
		PlayerBullet = 0x10,
	};
	enum BULLET_TYPE
	{
		BasicBullet = 0,
		MachineGunBullet,
		BulletCount
	};
	virtual BULLET_TYPE GetBulletType()
	{
		return BasicBullet;
	}

	int damage;
	float coolDownTime;
	Bullet();
	virtual Bullet* CreateBullet(Vector2f p);
	virtual ~Bullet();
	virtual void Hit();
	static BulletInitialValue bulletInitialValueList[Bullet::BulletCount];
	static void LoadBulletInitialValue(const char* data);
};
#endif